//  only for specific private communication
//
//  Xianguo Lu 
//  lu@physi.uni-heidelberg.de
//  Xianguo.Lu@cern.ch
//

class TH1;

class FitTRDdEdx
{
 public:
  typedef Double_t (*FFunc)(const Double_t *xx, const Double_t *par);

  static Int_t ChisquareFit(const TH1 *hh, FFunc func, const Int_t npar, Double_t pars[], Double_t errs[], Double_t chi[], const Double_t thres=0);
  
  static TH1D* DrawFunc(const TH1 * hh, FFunc func, const Double_t *par, const TString opt="", const Int_t color=kRed);
  
  static Double_t ALandau(const Double_t *xx, const Double_t *par);
  static Double_t ALG(const Double_t * xx, const Double_t * par);
  static Double_t DimlessALGE(const Double_t * xx, const Double_t * par);
  
 private:
  
  static Double_t NorDimlessLGE(const Double_t * par);
  
  static Double_t GetFCNChisquare(const Double_t npar, const Double_t pars[]);
  static void MinFCNChisquare(Int_t &npar, Double_t *gin, Double_t &f, Double_t *pars, Int_t iflag);

  static Int_t fgFitNData; //n data
  static Double_t *fgFitX; //data x
  static Double_t *fgFitY; //data y
  static Double_t *fgFitEy; //err y
  static FFunc fgFitFunc; //fit func
};
